package com.fimuz.mqmeet.api.role.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fimuz.mqmeet.api.role.dao.RoleDao;
import com.fimuz.mqmeet.api.role.service.RoleService;
import com.fimuz.mqmeet.api.role.service.model.GetSpModel;
import com.fimuz.mqmeet.api.role.service.model.GetSrModel;
import com.fimuz.mqmeet.api.role.service.model.ListSpModel;
import com.fimuz.mqmeet.api.role.service.model.ListSrModel;
import com.fimuz.mqmeet.helper.mybatis.dao.HxzAuthRoleMapper;
import com.fimuz.mqmeet.helper.mybatis.model.HxzAuthRole;
import com.fosun.spr.core.base.CoBaseService;
import com.fosun.spr.core.utils.ExtAsserts;
import com.fosun.spr.core.utils.SprDaoUtils;

@Transactional(rollbackFor = { RuntimeException.class, Exception.class })
@Service
public class RoleServiceImpl extends CoBaseService implements RoleService {
	@Resource
	private RoleDao roleDao;
	@Resource
	private HxzAuthRoleMapper hxzAuthRoleMapper;
 
	@Override
	public ListSrModel list(ListSpModel spModel) {
		ListSrModel srModel = new ListSrModel();
		srModel.setDatas(roleDao.list(spModel));
		//srModel.setTotalCount(roleDao.listCount(spModel));
		return srModel;
	}	
	@Override
	public GetSrModel get(GetSpModel spModel) {
		ExtAsserts.notNull(spModel.getId(),"id");
		GetSrModel srModel = new GetSrModel();
		HxzAuthRole record = (HxzAuthRole)SprDaoUtils.getById(hxzAuthRoleMapper, spModel.getId());
		cglibCopyProperties(record, srModel, true);
		return srModel;
	}	
	
}
